/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn;

import cn.webrx.services.User;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Date;

/**
 * <p>Project: spring2022 - Demo
 * <p>Powered by webrx On 2022-03-16 16:29:11
 * <p>Created by IntelliJ IDEA
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Demo {
    public static void main(String[] args) {
        var ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        var d1 = ctx.getBean(Date.class);
        var d2 = ctx.getBean("n");
        var d3 = ctx.getBean("n", Date.class);

        //java.util.Date 的实例
        System.out.println(d1);
        System.out.println(d1 == d2);
        System.out.println(d3 == d2);


        System.out.println(ctx.getBeanDefinitionCount());

        for (String n : ctx.getBeanDefinitionNames()) {
            if(n.contains("framework")) continue;
            System.out.println(n);
        }

        System.out.println(ctx.getBean("user"));
        System.out.println(ctx.getBean("us"));
        System.out.println(ctx.getBean("us"));
        System.out.println(ctx.getBean("us"));
        System.out.println(ctx.getBean("us"));

        //
        User us = new User(3,"jack");
        System.out.println(us);


    }
}
